import request from '@/utils/request';

export interface ICommentParams {
  /** 文章id或评论id */
  target: string;
  /** 评论内容 */
  content: string;
  /** 文章id，对评论回复时，必须传 */
  art_id?: string;
}
export const sendCommentAPI = (data: ICommentParams) => {
  return request({ url: '/v1_0/comments', method: 'post', data: data });
};

export const likeCommentByIdAPI = (id: string) => {
  return request({
    url: '/v1_0/comment/likings',
    method: 'post',
    data: {
      target: id,
    },
  });
};

export const dislikeCommentByIdAPI = (id: string) => {
  return request({
    url: '/v1_0/comment/likings/' + id,
    method: 'delete',
  });
};
